package com.alibaba.citrus.cr.b2b.trade.order.functions.utils;


import com.epoch.app.crb2btradecenter.dto.request.SendOutGoodsRequest;
import com.epoch.app.crb2btradecenter.enums.OrderStatus;
import com.epoch.app.crb2btradecenter.sdo.DeliverOrderSDO;
import org.springframework.util.StringUtils;

public class ModifyDeliverOrderConverter {

    public static DeliverOrderSDO converter(SendOutGoodsRequest request) {
        DeliverOrderSDO deliverOrderSDO = new DeliverOrderSDO();
        if (!StringUtils.isEmpty(request.getDeliveryOrderId())) {
            deliverOrderSDO.setId(Long.parseLong(request.getDeliveryOrderId()));
        }
        deliverOrderSDO.setDeliveryStatus(OrderStatus.SHIPPED.getCode());
        return deliverOrderSDO;
    }

    public static DeliverOrderSDO converterOne(SendOutGoodsRequest request) {
        DeliverOrderSDO deliverOrderSDO = new DeliverOrderSDO();
        if (!StringUtils.isEmpty(request.getDeliveryOrderId())) {
            deliverOrderSDO.setId(Long.parseLong(request.getDeliveryOrderId()));
        }
        deliverOrderSDO.setDeliveryStatus(OrderStatus.PARTIAL_DELIVER.getCode());
        return deliverOrderSDO;
    }
}